package tech.xs.sys.domain.bo.dict;

import cn.hutool.core.util.StrUtil;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import tech.xs.common.framework.domain.bo.PageBo;
import tech.xs.sys.domain.entity.SysChildDictData;

/**
 * @author 沈家文
 * @since 2023/5/30 19:52
 */
@Getter
@Setter
@ToString
public class PageChildDictDataBo extends PageBo<SysChildDictData> {

    private Long childDictId;
    private String likeName;


    public MPJLambdaWrapper<SysChildDictData> query() {
        return new MPJLambdaWrapper<SysChildDictData>()
                .selectAll(SysChildDictData.class)
                .eq(childDictId != null, SysChildDictData::getChildDictId, childDictId)
                .like(StrUtil.isNotBlank(likeName), SysChildDictData::getName, likeName)
                .orderByAsc(SysChildDictData::getOrderValue, SysChildDictData::getCreatedTime);
    }
}
